All Questions
14 questions
3votes
1answer
89views
Check which sinks are connected in the pipe system using Python
It would be very helpful to me as a beginner if I could get feedback on my code, specifically about the efficiency of algorithm used and potential improvements in code quality. Code context: There is ...
0votes
1answer
52views
Aggregate transactions in slips
I wrote code to aggregate transactions in slips. I'm concerned with the performance of my code because it uses 3 loops that are nested so the time complexity will be cubic. This code won't scale well ...
1vote
1answer
212views
Large file log parser with less memory footprint
This is a variation of an interesting problem I am currently dealing with. We have a large input file which is being continuously written (size: 10-20G). We need to write a log filter which reads ...
1vote
2answers
147views
"Frequency Counter Pattern", Can we get other better algorithm having like, O(n) or O(n log n)
Problem Statement : Write a function called matchSquare, which accept two arrays (arr1, arr2) Criteria: The function should return true, if every value in the arr1, has its corresponding values ...
4votes
1answer
230views
Segmented Sieve of Eratosthenes with wheel factorisation
Problem I have a project in which I implemented variants of the Sieve of Eratosthenes as well as benchmarking and profiling harnesses for these (which can be ran with ...
2votes
1answer
928views
Alpha beta pruning with memorization (transposition tables) and bitboards (5x5 cumulative tic-tac-toe)
This is my first time trying solve a game using these techniques. I've looked at pseudocode of alpha-beta pruning with transposition tables and rewritten it in c++. ...
3votes
0answers
196views
Memcpy function optimzation
Here is my memcpy algorithm I've been working on: ...
10votes
3answers
2kviews
Compression Library for C using Huffman Coding
This is an update to a question I posed nearly two years ago about my implementation of Huffman Coding which I had written in C. Since then I have had time to grow as a programmer and have managed to ...
0votes
2answers
302views
TrainSet Practice Problem from CodeChef
A dataset consisting of N items. Each item is a pair of a word and a boolean denoting whether the given word is a spam word or not. There shouldn't be a word included in the training set that's ...
1vote
2answers
74views
Check whether an array can be the result of merging two smaller arrays, maintaining order
I'm prepping for a tech interview coming up and trying to have a better understanding of what I should look out for in writing code. Also, feel free to correct the terminology that I use as I want to ...
7votes
3answers
9kviews
Rotation of elements in an array
We had to write a program that would perform rotation of elements in an array. The array size was entered by user, so it had to be in a sense, dynamic. Rotation or Circular Shifting Initial Array: <...
3votes
2answers
940views
Find two numbers that add up to a given total, from a formatted string
The full challenge from codeeval.com can be viewed here. Input Your program should accept as its first argument a filename. This file will contain a comma separated list of sorted numbers and ...
2votes
1answer
2kviews
Extract data from large JSON and find frequency of contiguous sub lists
I have been writing some code (see component parts here and here) that: Takes a very large JSON (15GB gzipped, ~10million records) Extracts the relevant parts of the JSON into a list of lists Creates ...
10votes
2answers
1kviews
Unique value finder
For our first assignment in our algorithm class we are suppose to solve several different questions using information from a 2D array. We are also suppose to optimize our code to get more marks on our ...